import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttentionStockVO, AttentionStockForm, AttentionStockQuery } from '@/api/stock/attentionStock/types';

/**
 * 查询关注分组明细列表
 * @param query
 * @returns {*}
 */

export const listAttentionStock = (query?: AttentionStockQuery): AxiosPromise<AttentionStockVO[]> => {
  return request({
    url: '/stock/attentionStock/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询关注分组明细详细
 * @param id
 */
export const getAttentionStock = (id: string | number): AxiosPromise<AttentionStockVO> => {
  return request({
    url: '/stock/attentionStock/' + id,
    method: 'get'
  });
};

/**
 * 新增关注分组明细
 * @param data
 */
export const addAttentionStock = (data: AttentionStockForm) => {
  return request({
    url: '/stock/attentionStock',
    method: 'post',
    data: data
  });
};

/**
 * 修改关注分组明细
 * @param data
 */
export const updateAttentionStock = (data: AttentionStockForm) => {
  return request({
    url: '/stock/attentionStock',
    method: 'put',
    data: data
  });
};

/**
 * 删除关注分组明细
 * @param id
 */
export const delAttentionStock = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stock/attentionStock/' + id,
    method: 'delete'
  });
};
